{% extends 'xadmin/base.html' %}
{% load staticfiles %}
{% load node_tag %}

{% block title %}
    用户
{% endblock %}

{% block css %}
    <link href="{% static 'xadmin/css/plugins/toastr/toastr.min.css' %}" rel="stylesheet">
    <link href="{% static 'xadmin/css/bootstrap-switch.css' %}" rel="stylesheet">
    <style>
        code{
            color: #1ab394;
        }
    </style>
{% endblock %}

{% block main %}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <form action="" method="get" class="form-inline col-lg-3" style="padding-left:40px;">{% csrf_token %}
                <input type="hidden" value="{{ siteid }}" name="siteid">
                <div class="form-group">
                    <label>搜索</label>
                    <input type="text" class="form-control input-sm" id="keywords" name="keyword" value="{{ keyword | default_if_none:'' }}" placeholder="用户名,操作关键字">
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-outline btn-default" style="margin-bottom: 0">搜索</button>
                </div>
            </form>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content" style="border-width:0px 0px">
                        <div class="table-responsive">
                            <table class="table table-striped  table-hover">
                                <thead style="background: rgba(237, 240, 245, 0.5);">
                                    <tr>
                                        <th>账号</th>
                                        <th>姓名</th>
                                        <th>操作</th>
                                        <th>时间</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {% for audit in audit_list %}
                                        <tr>
                                            <td>{{ audit.user.username }}</td>
                                            <td>{{ audit.user.chinese_name }}</td>
                                            <td><code>{{ audit.action }}</code></td>
                                            <td>{{ audit.add_time }}</td>
                                        </tr>
                                    {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div id="pagnitor" style="margin-left:40px;"></div>
        </div>
    </div>

{% endblock %}

{% block script %}
    <script src="{% static 'xadmin/js/bootstrap-switch.js' %}"></script>
    <script src="{% static 'xadmin/js/plugins/toastr/toastr.min.js' %}"></script>
    <script src="{% static 'xadmin/js/myjs/toastr_customer.js' %}"></script>
    <script>
        //分页
        var laypage = layui.laypage;
        laypage.render({
            elem: 'pagnitor'
            ,count: {{ paginator.count }} //数据总数
            ,limit: {{ pagesize }}
            ,curr: {{ pagenum }}
            ,hash: 'pagenum'
            ,jump: function(obj, first){
              if(!first){
                  curr = obj.curr;
                  window.location.href = window.location.pathname + '?siteid=' + '{{ siteid }}' + '&pagenum=' + curr;
                }
            }
          });
    </script>

{% endblock %}